$(function () {
    // 绑定 $DOM
    var $parkPintList = $('#parkPintList')
        , $choicePark = $('#choicePark')
        , $btnList = $('#btnList')
        , $lineLists = $('#lineLists')
        , $lineDetailWindow = $('#lineDetailWindow')
        , $footerMenu = $('#footerMenu')
        ;

    AMapUI.define("polyfill/require/require-css/css!plug/ext/font-awesome/css/font-awesome", [], function () { });
    var $container = $('#container');
    var mapInitData = {};
    mapInitData.center = 0;
    var imageLayer = new AMap.ImageLayer({
        url: 'http://amappc.cn-hangzhou.oss-pub.aliyun-inc.com/lbs/static/img/dongwuyuan.jpg',
        bounds: new AMap.Bounds(
            [116.327911, 39.939229],
            [116.342659, 39.946275]
        ),
        zooms: [3, 25]
    });

    //创建地图  
    var map = new AMap.Map('container', {
        zoom: mapInitData.scaleValue || 13,
        resizeEnable: true,
        center: mapInitData.initLocation ? mapInitData.initLocation.split(',') : '',
        layers: [
            new AMap.TileLayer(),
            imageLayer
        ]
    });

    // 地图拖拽事件
    map.on('dragstart', function () {
        $parkPintList.fadeOut(500);
    });


    // 地图缩放事件
    // map.on('zoomend', function(){
    //     var zoom = map.getZoom();
    //     if(zoom < 8 || zoom == 8) {
    //         map.clearMap();
    //     } else {
    //         map.add([polyline, polygon]);
    //     }
    // });

    AMap.plugin([
        'AMap.ToolBar',
    ], function () {
        // 在图面添加工具条控件，工具条控件集成了缩放、平移、定位等功能按钮在内的组合控件
        map.addControl(new AMap.ToolBar({
            // 简易缩放模式，默认为 false
            liteStyle: true
        }));
    });

    AMapUI.loadUI(['misc/MarkerList', 'overlay/SimpleMarker', 'overlay/SimpleInfoWindow', 'overlay/AwesomeMarker', 'misc/PathSimplifier'],
        function (MarkerList, SimpleMarker, SimpleInfoWindow, AwesomeMarker, PathSimplifier) {

            /***********************************************************************************************************************
             *  MarkList Init
             ***********************************************************************************************************************/
            var defaultIconStyle = { //默认的图标样式
                src: '/public/images/map/marker.png',
                style: {
                    width: '30px',
                    height: 'auto',
                    textAlign: 'center'
                }
            },
                defaultIconLabel = {
                    style: {
                        color: '#fff',
                        fontSize: '18px',
                    }
                },
                selectedIconStyle = {  //选中时的图标样式
                    src: '/public/images/map/marker.png',
                    style: {
                        width: '40px',
                        height: 'auto',
                        textAlign: 'center'
                    }
                },
                selectedIconLabel = {
                    style: {
                        color: '#fff',
                        fontSize: '24px',
                    }
                };

            var markerListOption = {
                map: map,
                //从数据中读取位置, 返回lngLat
                getPosition: function (item) {
                    return typeof item.serviceLocation === 'string' ? item.serviceLocation.split(',') : [];
                },
                //数据ID，如果不提供，默认使用数组索引，即index
                getDataId: function (item, index) {
                    return item.id;
                },
                getInfoWindow: function (data, context, recycledInfoWindow) {
                    var tplBody = '', img = '';
                    if (data.serviceType === 'scenic') {
                        tplBody = '<div class="window-content fl">'
                            + '<p class="window-desc">' + data.serviceInfo + '</p> <div class="window-btns">';

                        if (data.serviceContent) {
                            tplBody += '    <a href="/publicMap/showInfo/' + data.id + '" class="window-park-detail">详情</a>';
                        }
                        tplBody += '    <a href="//uri.amap.com/navigation?to=' + data.serviceLocation + ',' + data.serviceName+ '&mode=car&callnative=1" class="window-park-go">去这里</a></div></div >';
                        if (data.imageAddr || data.iconAddr) {
                            img = '<img class="park-detail-img fl" src="' + (data.imageAddr || data.iconAddr) + '?imageMogr2/thumbnail/640x/strip/quality/50"/>'
                        } else {
                            img = '<i class="park-detail-img fl xx-icon icon-' + data.serviceType + '"></i>'
                        }

                        return new SimpleInfoWindow({
                            //模板, underscore
                            infoTitle: '<strong class="park-title"><%- title %></strong>',
                            infoBody: '<div class="park-window clearfix">' +
                                //<%= 原值插入 ..
                                '<%= img %>' +
                                //<%- html编码后插入
                                '<%= body %>' +
                                '</div>',
                            //模板数据
                            infoTplData: {
                                title: data.serviceName,
                                img: img,
                                body: tplBody
                            },
                            autoMove: false,
                            showShadow: true,
                            //基点指向marker的头部位置
                            offset: new AMap.Pixel(-1, -65)
                        });
                    }
                    else {
                        tplBody = '<div class="window-other-content clearfix">'
                            + '<i class="other-icon xx-icon icon-' + data.serviceType + '"></i>'
                            + '<a align="right" class="other-go-btn" href="//uri.amap.com/navigation?to=' + data.serviceLocation + ',' + data.serviceName + '&mode=car&callnative=1">去这里</a></div>';
                        return new SimpleInfoWindow({
                            //模板, underscore
                            infoTitle: '<strong class="park-title park-other-title"><%- title %></strong>',
                            infoBody: '<div class="park-window clearfix">' +
                                //<%- html编码后插入
                                '<%= body %>' +
                                '</div>',
                            //模板数据
                            infoTplData: {
                                title: data.serviceName,
                                body: tplBody
                            },
                            autoMove: false,
                            showShadow: true,
                            //基点指向marker的头部位置
                            offset: new AMap.Pixel(-1, -65)
                        });
                    }

                },

                //构造marker用的options对象, content和title支持模板，也可以是函数，返回marker实例，或者返回options对象
                getMarker: function (data, context, recycledMarker) {

                    return new AwesomeMarker({
                        containerClassNames: 'my-marker',
                        //设置awesomeIcon
                        awesomeIcon: 'icon-' + data.serviceType,

                        getClassnamesOfAwesomeIcon: function (icon) {
                            //返回 iconfont的classname 结构
                            return 'xx-icon icon-' + data.serviceType;
                        },
                        iconLabel: defaultIconLabel,
                        iconStyle: defaultIconStyle,
                        offset: new AMap.Pixel(-15, -45),
                        map: map,
                        position: data.serviceLocation,
                        showPositionPoint: false,
                        zIndex: 98
                    });

                },
                //marker上监听的事件
                markerEvents: ['click'],
                //makeSelectedEvents:false,
                selectedClassNames: 'selected',
                autoSetFitView: false,
            }
            var markerList = new MarkerList(markerListOption);
            window.markerList = markerList;

            var sortResult = $('#sortResult').data('sort');

            // 初始化页面显示
            if ($parkPintList.length > 0) {
                var serviceId = getCookie('s_id') || '';
                var hasChangePark = true, firstId, firstName, toUrl;
                if ($parkPintList.find('.park-name').length > 0) {
                    $parkPintList.find('.park-name').each(function (index) {
                        var $this = $(this), thisId = $this.data('id');
                        if (index === 0) {
                            firstId = thisId;
                            firstName = $this.text();
                            toUrl = $this.data('url');
                        }
                        if (thisId === +serviceId) {
                            $choicePark.find('.header-park-name').text($this.text());
                            toUrl = $this.data('url');
                            hasChangePark = false;
                        }
                    })

                    $('#goParkDetail').attr('href', toUrl);

                    if (!serviceId || hasChangePark) {
                        serviceId = firstId;
                    }

                    getResetParkDate(serviceId, 1, function () {
                        if (sortResult && sortResult.serviceType) {
                            loadSortPoint(sortResult)
                        } else {
                            var _serviceType = $btnList.find('.menu-item').eq(0).data('type');
                            var serviceType = getCookie('s_type');
                            if ($footerMenu.find('.menu-item').length > 0) {
                                if (!serviceType || serviceType === _serviceType || hasChangePark) serviceType = _serviceType;
                                loadData(serviceType);
                                var $curMenu = $footerMenu.find('.icon-' + serviceType);
                                $footerMenu.find('.menu-item').removeClass('on');
                                $curMenu.length > 0
                                    ? $curMenu.parents('.menu-item').addClass('on')
                                    : $footerMenu.find('.menu-item').eq(0).addClass('on')
                            }
                            else if (!hasChangePark) {
                                deleteCookie('s_type');
                            }
                        }
                    });
                    if (hasChangePark) {
                        $choicePark.find('.header-park-name').text(firstName);
                        setCookie('s_id', firstId)
                        deleteCookie('s_type');
                    }
                }

            } else {
                deleteCookie('s_type');
                deleteCookie('s_id');
            }

            markerList.on('selectedChanged', function (event, info) {

                if (info.selected) {
                    if (info.selected.marker) {
                        //更新为选中样式
                        info.selected.marker.setIconStyle(selectedIconStyle);
                        info.selected.marker.setIconLabel(selectedIconLabel);
                        info.selected.marker.setOffset(new AMap.Pixel(-20, -60));
                    }
                }

                if (info.unSelected && info.unSelected.marker) {
                    //更新为默认样式
                    info.unSelected.marker.setIconStyle(defaultIconStyle);
                    info.unSelected.marker.setIconLabel(defaultIconLabel);
                    info.unSelected.marker.setOffset(new AMap.Pixel(-15, -45));
                }
            });

            markerList.on('markerClick', function (event, record) {
                if (record && record.marker) {
                    forcusMarker(record.marker);
                }
            });

            //数据输出完成
            markerList.on('renderComplete', function (event, records) {
                // console.log('event', event);
            });

            //加载数据
            function loadData(type, callback) {
                var serviceType = type || '';
                $.ajax({
                    url: '/publicMap/getServicePoint/?serviceType=' + serviceType,
                    type: 'GET',
                    beforeSend: function (xhr) {
                        $.showLoading();
                    },
                    complete: function (xhr, status) {
                        $.hideLoading();
                    },
                    success: function (body) {
                        //渲染数据
                        if (body.data && body.data.rows.length > 0) {
                            if (!mapInitData.center) {
                                markerList.setOption('autoSetFitView', false);
                                map.setCenter(mapInitData.initLocation ? mapInitData.initLocation.split(',') : '');
                                map.setZoom(mapInitData.scaleValue);
                            }

                            markerList.render(body.data.rows);
                        } else {
                            markerList.clearData()
                        }
                    },
                    error: function (error) {
                        console.log(error)
                    }
                })

            }
            // 加载搜索点
            function loadSortPoint(sortData) {
                mapInitData.center = 1;
                map.setCenter(sortData.serviceLocation.split(','));
                markerList.setOption('autoSetFitView', true);
                markerList.render([sortData]);
                $btnList.find('.menu-item').removeClass('on');
                // data.serviceLocation + '&name=' + data.serviceInfo + '
            }

            function forcusMarker(marker) {
                marker.setTop(true);
                //不在地图视野内
                map.panTo(marker.getPosition());
                // if (!(map.getBounds().contains(marker.getPosition()))) {
                //     //移动到中心
                //     map.setCenter(marker.getPosition());
                // }
            }
            /**********************************************************************************************************************
             * PathSimplifiter Init
             **********************************************************************************************************************/
            var defaultRenderOptions = {
                renderAllPointsIfNumberBelow: -1,
                pathTolerance: 2,
                keyPointTolerance: 0,
                pathLineStyle: {
                    lineWidth: 6,
                    strokeStyle: '#1bac2e',
                    borderWidth: 1,
                    borderStyle: '#eeeeee',
                    dirArrowStyle: true
                },
                pathLineSelectedStyle: {
                    lineWidth: 6,
                    strokeStyle: '#C11534',
                    borderWidth: 1,
                    borderStyle: '#cccccc',
                    dirArrowStyle: true
                },
                dirArrowStyle: {
                    stepSpace: 35,
                    strokeStyle: '#ffffff',
                    lineWidth: 2
                },
                keyPointStyle: {
                    radius: 3,
                    fillStyle: 'rgba(8, 126, 196, 1)',
                    lineWidth: 1,
                    strokeStyle: '#eeeeee'
                },
                keyPointOnSelectedPathLineStyle: {
                    radius: 4,
                    fillStyle: 'rgba(8, 126, 196, 1)',
                    lineWidth: 3,
                    strokeStyle: '#eeeeee'
                }
            };

            var pathSimplifierIns = new PathSimplifier({
                zIndex: 96,
                autoSetFitView: true,
                map: map, //所属的地图实例
                getPath: function (pathData, pathIndex) {
                    if (pathData.point) {
                        var points = JSON.parse(pathData.point),
                            lnglatList = [];

                        for (var i = 0, len = points.length; i < len; i++) {
                            lnglatList.push([points[i].lng, points[i].lat]);
                        }
                        console.log(lnglatList)
                        return lnglatList;
                    }
                },
                renderOptions: defaultRenderOptions
            });

            window.pathSimplifierIns = pathSimplifierIns;
            // pathSimplifierIns.setSelectedPathIndex(0);

            /*********************************************************************************************************************
             *  页面逻辑处理
             *********************************************************************************************************************/

            // 展示底部菜单
            touch.on('#btnList', 'swipeup', function () {
                var $this = $(this);
                var $realHeight = $footerMenu.height();
                $this = $this.hasClass('map-footer-warp')
                    ? $this
                    : $this.parents('.map-footer-warp');

                $this.height($realHeight)
            });

            // 收起底部菜单
            touch.on('#btnList', 'swipedown', function () {
                var $this = $(this);
                $this = $this.hasClass('map-footer-warp')
                    ? $this
                    : $this.parents('.map-footer-warp');
                $this.css('height', '3.8rem');
            });


            // 收起线路列表
            touch.on('#lineLists', 'swipedown', function () {
                mapInitData.autoSetFitView = 0;
                markerList = new MarkerList(markerListOption);  // 重置地图
                window.markerList = markerList;
                var $this = $(this);
                $this = $this.hasClass('line-list-warp')
                    ? $this
                    : $this.parents('.line-list-warp');
                $this.height(0);
                $('#btnList').css('height', '3.8rem');
            });

            //展示可选景点
            $choicePark.on('tap', function () {
                var $this = $(this);
                var $icon = $this.find('.xx-icon');

                $icon.hasClass('down')
                    ? $icon.removeClass('down')
                    : $icon.addClass('down');

                if ($parkPintList.css('display') === 'none') {
                    $parkPintList.fadeIn(500)
                    bindCloseChoicePark();
                } else {
                    $parkPintList.fadeOut(500);
                    unbindCloseChoicePark();
                }
            })

            // 地图点击事件
            map.on('dragstart', function () {
                $parkPintList.fadeOut(500);
                $lineLists.height(0);
                menuInit()
                unbindCloseChoicePark();
            });
            map.on('click', function () {
                $parkPintList.fadeOut(500);
                $lineLists.height(0);
                menuInit()
                unbindCloseChoicePark();
            });

            // 绑定关闭可选景点框
            function bindCloseChoicePark(e) {
                $(document).bind('click', function (e) {
                    if (e.target !== $parkPintList) {
                        $parkPintList.fadeOut(500);
                        $(document).unbind('click');
                        console.log('CloseChoicePark')
                    }
                })
            }

            // 解除绑定关闭可选景点框
            function unbindCloseChoicePark() {
                $(document).unbind('click');
            }

            /**
             * 景区选择
             */
            $parkPintList.find('.park-name').on('tap', function () {
                var $this = $(this)
                    , serviceId = $this.data('id')
                    , thisUrl = $this.data('url')
                    ; 
                deleteCookie('s_type');    
                setCookie('s_id', serviceId);
                $('#goParkDetail').attr('href', thisUrl);
                $choicePark.find('.header-park-name').text($this.text());
                $choicePark.find('.xx-icon').removeClass('down');
                $parkPintList.fadeOut(500);
                $(document).unbind('click');
                $lineDetailWindow.height(0);
                $lineLists.height(0);
                pathSimplifierIns.setData();

                getResetParkDate(serviceId);
            })

            function getResetParkDate(serviceId, isFirst, cb) {
                var isFirst = isFirst || 0;
                $.ajax({
                    url: '/publicMap/resetPark?serviceid=' + serviceId + '& isFirst=' + isFirst,
                    type: 'GET',
                    beforeSend: function (xhr) {
                        $.showLoading();
                    },
                    complete: function (xhr, status) {
                        $.hideLoading();
                    },
                    success: function (body) {
                        var menuDom = '';
                        var defaultType = '';
                        if (body.parkInfo.status === 200 && body.parkInfo.data) {
                            var parkInfo = body.parkInfo.data;
                            mapInitData = parkInfo;
                            if (parkInfo.initLocation) map.setCenter(parkInfo.initLocation.split(','));
                            if (parkInfo.scaleValue) map.setZoom(parkInfo.scaleValue);
                            if (parkInfo.imageAddr && parkInfo.coordsYs && parkInfo.coordsZx) {

                                imageLayer.setBounds(
                                    new AMap.Bounds(
                                        parkInfo.coordsZx.split(','),
                                        parkInfo.coordsYs.split(',')
                                    )
                                )
                                imageLayer.setImageUrl(parkInfo.imageAddr);
                                imageLayer.show();

                            } else {
                                imageLayer.hide();
                            }
                        }

                        if (body.footerMenuData.status === 200 && body.footerMenuData.data) {
                            var menuData = body.footerMenuData.data;
                            if (menuData.length > 0) {
                                for (var i = 0; i < menuData.length; i++) {
                                    var itemMenu = menuData[i];
                                    if (i === 0) defaultType = itemMenu.serviceType;
                                    menuDom += '<a class="menu-item" href="javascript:;" data-type="' + itemMenu.serviceType + '"><i class="xx-icon icon-' + itemMenu.serviceType + '"></i><p>' + itemMenu.serviceTypeName + '</p></a>'
                                }
                                $footerMenu.find('.footer-menu-list').html(menuDom);
                                menuInit()
                            }
                            else {
                                $btnList.height(0);
                                $footerMenu.find('.footer-menu-list').html('');
                            }

                            if (!isFirst) {
                                loadData(defaultType);
                                $footerMenu.find('.menu-item').eq(0).addClass('on');
                            } else {
                                cb && cb()
                            }
                            menuBindTap()
                        }


                    },
                    error: function (error) {
                        console.log(error)
                    }
                })

            }

            $('#showLines').on('tap', function (event) {
                getLineLists()
            });

            /**
             * 底部菜单点击
             */
            function menuBindTap() {
                $btnList.find('.menu-item').unbind('click').on('click',function (e) {
                    var $input = $(this),
                        dataType = $input.data('type');
                    $btnList.find('.menu-item').removeClass('on');
                    $input.addClass('on');
                    markerList.setOption('autoSetFitView', true);
                    mapInitData.center = 1;
                    if (dataType) {
                        setCookie('s_type', dataType)
                        loadData(dataType);
                    }
                });
            }

            /**
             * 初始化底部导航
             */
            function menuInit() {
                if ($btnList.find('.menu-item').length > 0)
                    $btnList.css('height', '3.8rem');
            }


            function isElementInViewport(el) {
                var rect = el.getBoundingClientRect();
                return (
                    rect.top >= 0 &&
                    rect.left >= 0 &&
                    rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */
                    rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */
                );
            }

            /**
             * 获取线路列表
             */
            var lineSwiper = null, linesData = null;
            function getLineLists(selectedId) {
                var $lineDetail = $('#lineDetail');
                $.ajax({
                    url: '/line/list',
                    type: 'GET',
                    beforeSend: function (xhr) {
                        $.showLoading();
                    },
                    complete: function (xhr, status) {
                        $.hideLoading();
                    },
                    success: function (body) {
                        if (body.status === 200 && body.data && body.data.rows.length > 0) {
                            console.log(body)
                            linesData = body.data.rows;
                            $btnList.height(0) // 收起底部菜单
                            $lineDetailWindow.height(0);
                            markerList.clearData()// 清除景点标记
                            pathSimplifierIns.setData();

                            $lineLists.find('.footer-line-lists').html(lineListHtml(linesData));
                            $lineDetail.html(lineDetailHtml(linesData));

                            setTimeout(function () {
                                var thisHeight = $lineLists.find('.footer-line-lists').height();
                                $lineLists.height(thisHeight);
                                $btnList.find('.menu-item').removeClass('on');
                                $lineLists.find('.showLineDetail').unbind('click').on('click', lineBtnBindTap);
                                if ($('#lineDetail .swiper-container').length > 0) {
                                    lineSwiper = new Swiper('#lineDetail .swiper-container', {
                                        pagination: {
                                            el: '.swiper-pagination'
                                        },
                                        on: {
                                            slideChange: function () {
                                                getLinePints(this.activeIndex);
                                            },
                                        }
                                    });
                                } else {
                                    lineSwiper = null;
                                }
                            }, 500);
                        } else {
                            $.alert({
                                text: '没有相关线路',
                                onOK: function () {
                                    //点击确认
                                }
                            });
                            menuInit();
                        }

                        body = null;
                    }
                });

            }

            /**
             * 绑定查看线路详情事件
             */
            function lineBtnBindTap(e) {
                var $this = $(this);
                var index = +$this.data('index');
                $('#lineLists').height(0);
                getLinePints(index)
                if (lineSwiper) lineSwiper.slideTo(index);
                setTimeout(function () {
                    $('#lineDetailWindow').css('height', '6.7rem');
                }, 500);
            }

            function getLinePints(index) {

                var thisLineData = linesData[index];
                if (!mapInitData.center) {
                    markerList.setOption('autoSetFitView', true);
                    mapInitData.center = 1;
                }

                if (thisLineData.guidePublicServiceDetails.length > 0) {
                    markerList.render(thisLineData.guidePublicServiceDetails)
                    $('#lineStand').html(pointName(thisLineData.guidePublicServiceDetails));
                    new Swiper('#lineStand .swiper-container', {
                        slidesPerView: 'auto',
                        // centeredSlides: true,
                        spaceBetween: 5
                    })

                }
                else {
                    markerList.clearData();
                }

                if (thisLineData.guidePublicServicePoints.length > 0) {
                    // console.log(pathSimplifierIns.getZIndex())      
                    pathSimplifierIns.setData(thisLineData.guidePublicServicePoints);
                    console.log(thisLineData.guidePublicServicePoints)
                }
                else {
                    pathSimplifierIns.setData();
                }
            }

        })


    /**
     * 拼接线路列表数据
     */
    function lineListHtml(listData) {
        var lineDom = '';
        for (var i = 0; i < listData.length; i++) {
            var services = listData[i].serviceIds.split(',').length;
            lineDom += '<div class="line-item"><div class="line-cell line-content"><p class="line-title">' +
                listData[i].routeName + '</p><div class="line-desc">'
                + '<span>约<strong>' + listData[i].tourTime + '</strong>个小时</span>'
                + '<span data-serivices=' + listData[i].serviceIds + '>景点数<strong>' + services + '</strong>个</span>'
                + '<span>约<strong>' + listData[i].mileage + '</strong>公里</span></div></div>'
                + '<div class="line-cell line-btns" align="right"><a data-index=' + i + ' data-id=' + listData[i].id + ' class="showLineDetail" href="javascript:;">查看</a></div></div>'
        }

        return lineDom;
    }

    /**
     * 线路详情轮播
     * @param {Array} detailList 
     */
    function lineDetailHtml(listData) {
        var detailDom = listData.length > 1
            ? '<div class="swiper-container line-detail-container"><div class="swiper-wrapper">'
            : '<div class="line-detail-container"><div class="swiper-wrapper">';

        for (var i = 0; i < listData.length; i++) {
            var services = listData[i].serviceIds.split(',').length;
            detailDom += '<div class="swiper-slide line-slide-' + listData[i].id + '" data-id=' + listData[i].id + ' data-i=' + i + ' ><div class="line-detail-content">'
                + '<p class="line-detail-title">' + listData[i].routeName + '</p>'
                + '<div class="line-detail-info">'
                + '<a class="fr" href="/line/detail/' + listData[i].id + '" >线路详情</a>'
                + '<div class="line-info-desc">'
                + '<span>约<strong>' + listData[i].tourTime + '</strong>个小时</span>'
                + '<span data-serivices=' + listData[i].serviceIds + '>景点数<strong>' + services + '</strong>个</span>'
                + '<span>约<strong>' + listData[i].mileage + '</strong>公里</span></div></div></div></div>'
        }
        detailDom += '</div><div class="swiper-pagination"></div></div>'
        return detailDom;
    };

    function pointName(pointList) {
        var pointName = '<div class="line-stand-container swiper-container"><div class="swiper-wrapper">';

        for (var i = 0; i < pointList.length; i++) {
            pointName += '<div class="swiper-slide"><span class="line-stand-item">' + pointList[i].serviceName + '</span><i class="xx-icon ' + (i === (pointList.length - 1) ? '' : 'icon-jiantou') + '"></i></div>'
        }

        pointName += '</div></div>'
        return pointName;
    }
});
